
OBJS= $(patsubst %.c,%.o,$(wildcard src/*.c))
CFLAGS=-marm
LDFLAGS=-Tmap.lds
TARGET=main.bin
COURSE1=main.elf

$(TARGET):$(COURSE1)
	arm-linux-gnueabihf-objcopy -O binary $< $@
$(COURSE1):$(OBJS)
	arm-linux-gnueabihf-ld $^ -o $@ $(LDFLAGS)
src/%.o:src/%.c
	arm-linux-gnueabihf-gcc -c $< -o $@ $(CFLAGS)
clean:
	rm $(TARGET) $(OBJS) $(COURSE1)

test:
	gcc test.c -o test
test_clean:
	rm test
